<template>
  <div>
    <el-table
      ref="gjTable"
      v-loading="loading"
      border
      :data="trajectoryList"
      max-height="500px"
    >
      <el-table-column
        resizable
        label="原始轨迹"
        align="center"
        prop="description"
      ></el-table-column>
      <el-table-column label="日期" align="center" prop="day"></el-table-column>
      <el-table-column label="操作人" align="center" prop="name"></el-table-column>
      <el-table-column label="轨迹日期" align="center" prop="operatorDateUpdate">
        <!-- <template #default="scope">
          <el-popover
            v-model="scope.row.dateVisible"
            placement="top"
            width="400" 
            @show="updateDate(scope.row)"
          >
            <el-form :model="dateForm">
              <el-form-item prop="operatorDateUpdates">
                <el-date-picker
                  v-model="dateForm.operatorDateUpdates"
                  clearable
                  value-format="YYYY-MM-SS"
                  format="YYYY-MM-SS"
                  type="datetime"
                  placeholder="选择日期" 
                  style="margin-right: 10px;"
                ></el-date-picker>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" style="margin-left: 5px;" @click="changeDate(scope.row)">确定</el-button>
                <el-button @click="scope.row.dateVisible = false">取消</el-button>
              </el-form-item>
            </el-form>
            <el-button slot="reference" type="text">
              {{ scope.row.operatorDateUpdates || "无数据" }}
            </el-button>
          </el-popover>
        </template> -->
      </el-table-column>
      <el-table-column label="轨迹内容" align="center" prop="operableTrack">
        <!-- <template #default="{ row }">
          <el-popover v-model="row.visible" placement="top" width="400">
            <el-form :model="nameForm">
              <el-form-item prop="operableTrack">
                <el-input
                  v-model="nameForm.operableTrack"
                  style="width: 335px;"
                  clearable
                  type="textarea"
                  autosize
                ></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" style="margin-left: 5px;" @click="submitEditName(row)">修改</el-button>
                <el-button @click="row.visible = false">取消</el-button>
              </el-form-item>
            </el-form>
            <el-button type="text">
              {{ row.operableTrack || "无数据" }}
            </el-button>
          </el-popover>
        </template> -->
      </el-table-column>
      <el-table-column
        label="备注"
        align="center"
        prop="remarks"
        show-overflow-tooltip
      ></el-table-column>
    </el-table>
  </div>
</template>
<script lang="ts" setup>
import { ref, getCurrentInstance } from 'vue'
import { ElMessage, ElMessageBox, ElButton } from 'element-plus'
import { fedexOrderNo } from '@/api/expressManager/orderList'

const { proxy } = getCurrentInstance() as any
const loading = ref(false)
const trajectoryList = ref([])
const gjTable = ref()
const orderNos = ref([])
// const dateForm = ref({
//   operatorDateUpdates: '',
// })
// const nameForm = ref({
//   operableTrack: '',
// })
// const updateDate = (row) => {}
// const changeDate = (row) => {}
// const submitEditName = (row) => {}
const initKP = () => {
  const data = orderNos.value
  loading.value = true
  fedexOrderNo(data).then(res => {
    if (res.code == 200) {
      trajectoryList.value = res.data
      loading.value = false
    } else {
      loading.value = false
    }
  }).catch(() => {
    loading.value = false
  })
}

defineExpose({
  initKP,
  orderNos,
})
</script>